package t409

func longestPalindrome(s string) int {

	m := make(map[string]int)

	for _, v := range s {
		//log.Println(k, string(v))
		m[string(v)] = (m[string(v)]) + 1
	}

	single := false

	sum := 0
	for _, v := range m {
		if v%2 == 1 {
			if single == false {
				single = true
				sum++
			}
			sum += v - 1
		} else {
			sum += v
		}
	}

	return sum
}
